package com.tensquare.recruit.service;

import com.tensquare.recruit.dao.RecruitDao;
import com.tensquare.recruit.pojo.Recruit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import util.IdWorker;

import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * 服务层
 * 
 * @author Administrator
 *
 */
@Service
public class RecruitService {

	@Autowired
	private RecruitDao recruitDao;

	@Autowired
	private IdWorker idWorker;

	/**
	 * 查询状态为2并以创建日期降序排序，查询前6条记录
	 * @return
	 */
	public List<Recruit> findTop6ByStateOrderByCreatetime() {
		return recruitDao.findTop6ByStateOrderByCreatetimeDesc("2");
	}

	/**
	 * 最新职位列表
	 * @return
	 */
	public List<Recruit> findTop6ByStateNotOrderByCreatetimeDesc(){
		return recruitDao.findTop6ByStateNotOrderByCreatetimeDesc("0");
	}
}